<template>
	<view >
			<view class="" v-for="(item, index) in list" :key="index">
				<view class="" style="background: #eee;padding: 10rpx 27rpx;">
					{{item.year}}款
				</view>
				<view class="list-cell u-border-bottom" v-for="item1 in item.sonList" :key="item1" @click="carType(item1)">
						<view class="">
							{{item1.modelName}}
						</view>
						<view style="float: right;color: #c72c2c;">
							{{item1.startingPrice}}万
						</view>
					</view>
			</view>
	</view>
</template>

<script>
import API from "@/api/selectCar.js"
import app from "../../App.vue"
	export default {
		name:'carType',
		onLoad(options){
			this.seriesId = options.seriesId;
		},
		onShow() {
			this.getCarModelList();
		},
		data() {
			return {
				seriesId:"",
				scrollTop: 0,
				list: []
			}
		},
		methods:{
			getCarModelList(){
				let data = {
					seriesId:this.seriesId
				}
				API.getCarModelList(data).then(res=>{
					console.log(res);
					this.list = res.data;
				})
			},
			
			carType(item){
				app.globalData.carType=item
				uni.navigateBack({
					delta: 3
				})
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		}
	}
</script>

<style lang="scss" scoped>
	.list-cell {
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: $u-content-color;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}
</style>
